package user_local_ewallet

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/rpc-client/assetsClient/rpc"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserLocalEWalletDeleteLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 删除
func NewUserLocalEWalletDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLocalEWalletDeleteLogic {
	return &UserLocalEWalletDeleteLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserLocalEWalletDeleteLogic) UserLocalEWalletDelete(req *types.UserLocalEWalletsDelRequest) (resp *types.UserLocalEWalletsDelResponse, err error) {
	info, err := l.svcCtx.AssetsRpc.UserChannel.UserLocalEWalletsDel(l.ctx, &rpc.UserLocalEWalletsDelRequest{
		Id: req.Id,
	})
	if err != nil {
		return &types.UserLocalEWalletsDelResponse{
			IsDel: false,
		}, err
	}
	return &types.UserLocalEWalletsDelResponse{
		IsDel: info.IsDel,
	}, nil
}
